@echo off
title PyCTP Build Script
echo.
echo ================================================
echo PyCTP Build Script
echo ================================================

REM Check Python availability
python --version >nul 2>&1
if errorlevel 1 (
    echo ERROR: Python is not in PATH
    pause
    exit /b 1
)

REM Change to gen_tools directory
cd /d "%~dp0gen_tools"

REM Run the complete build process
echo Running complete build process...
python prepare_gen.py ctp\v6.7.11_20250617\win64


python prepare_gen.py --swig


python compile_simple.py
if errorlevel 1 goto error

python install_complete.py
if errorlevel 1 goto error

echo.
echo ================================================
echo SUCCESS: Build completed!
echo ================================================
pause
exit /b 0

:error
echo.
echo ================================================
echo ERROR: Build failed - check messages above
echo ================================================
pause
exit /b 1